package se.sll.itintegration.catalogue.gui.service;

import java.util.ArrayList;
import java.util.List;

import javax.ejb.Stateless;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;

import se.sll.itintegration.catalogue.gui.data.RoleType;
import se.sll.itintegration.catalogue.gui.entity.UserEntity.ROLES;
import se.sll.service.catalogue.common.exception.ServiceException;
import se.sll.service.catalogue.gui.api.model.RoleInfoList;
import se.sll.service.catalogue.gui.api.resource.RolesService;

/**
 *
 * @author khaleddaham
 */
@Path("/roles")
@Stateless
public class RolesFacadeREST implements RolesService {
    /**
     * Get all roles
     *
     * @return
     */
    @Override
    public GetRolesResponse getRoles() throws ServiceException {
        List<RoleInfoList> roles = new ArrayList<>();
        for(ROLES role : ROLES.values()) {
            RoleInfoList r = new RoleInfoList();
            r.setRole(role.name());
            roles.add(r);
        }
        return GetRolesResponse.jsonOK(roles);
    }
}